class Networkerror(BaseException):
    def __init__(self, msg):
        self.msg = msg

    def __str__(self):
        return self.msg


try:
    raise Networkerror("抛出异常")
except Networkerror as e:
    print(e.__str__())
else:
    print("不发生异常时执行")
finally:
    print("异常与否都执行")





















